<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>活动报名</title>
    <meta charset="utf-8">   
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" type="text/css" href="{$Think.config.static_path}apply/css/main.css">
    <link rel="stylesheet" type="text/css" href="{$Think.config.static_path}apply/css/common.css">
	<style type="text/css">
		#loading{
			text-align:center;
			position:fixed;
			top:45%;
			height:100%;
			left:50%;
		}

	</style>
</head>
<body class="layout">
	<div>
		<img src="{$Think.config.static_path}apply/images/top.png" style="width:100%">
		<div class="form-choose">
			<div class="appname">
				<label>App名称</label><input type="text" placeholder="请输入3-5个汉字" maxlength="5" id="name">
			</div>
			<div class="appcontent">
				<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;含义</label><textarea type="text" rows="5" cols="20" maxlength="5" id="content"></textarea>
			</div>
			<div class="btn" id="submit">立即报名</div>
		</div>
		<p class="rule">
			<img src="{$Think.config.static_path}apply/images/rule.png">
		</p>
	</div>
</body>
<script charset="utf-8" type="text/javascript" src="{$Think.config.static_path}jquery-2.1.4.min.js"></script>
<script charset="utf-8" type="text/javascript" src="{$Think.config.static_path}apply/js/util.js"></script>
<script charset="utf-8" type="text/javascript" src="{$Think.config.static_path}js/vote.js"></script>
<script charset="utf-8" type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
	weixinShare({$signPackage},{$sharePackage});
	$("#submit").click(function(){
		var openid = "{$openid}";
		var name=$("#name").val();
		var content=$("#content").val();
		if(Util.isEmpty(name)){
			Util.info("请输入app名称");
			return;
		}
		if(name.length<3){
			Util.info("app名称必须为3-5个汉字");
			return;
		}
		if(!(/^[\u4e00-\u9fa5]+$/.test(name))){
			Util.info("app名称必须为3-5个汉字");
			return;
		}
		if(Util.isEmpty(content)){
			Util.info("请输入app含义");
			return;
		}
		
        Util.ajax({
			method:'post',
			data:'app_name='+name+'&app_info='+content+'&openid='+openid,
			url:'__URL__/ajaxInsert'},
			function(json) {
				if(json.status  == 2){
					 location.href = json.url;
				}
				if(json.status  == 1){
					Util.info(json.info);
					setTimeout(function () {
						  location.href="__URL__/applyInfo?id="+json.id+"&showmsg=1";
					}, 1000);
					
				}else{
					Util.info(json.info);
				}
		});
		
	})

</script>
</html>